<?php
//$b=[
//    [1,2,3],
//    [4,5,6]
//];
//$a=['arr'=>1];
//$a['k'][]=$b;
//echo $a['k'][0][0][2];
//
//$a=['arr'=>1
//    ,'k'=>[
//        [
//            [1,2,3],
//            [4,5,6]
//        ]
//    ]];
//
//echo $a['k'][0][0][2];
//echo time();

function getperiod($start)
{
    $dayofweek = (int) date('w', strtotime($start));
    $dayofweek = $dayofweek === 0 ? 7 : $dayofweek;
    $days_left = 8 - $dayofweek;

    $result = new DatePeriod(
        new DateTime(date(DATE_COOKIE, strtotime($start . "- {$dayofweek}days"))),
        new DateInterval('P1D'),
        new DateTime(date(DATE_COOKIE, strtotime($start . "+ {$days_left}days")))
    );
    $result = iterator_to_array($result);
    array_shift($result);
    return $result;
}

$s = '2022-03-21';
echo 'Today: ' . $s . PHP_EOL;
$p = getperiod($s);
foreach ($p as $d) {
    echo $d->format('Ymd') . "\n";
}